package com.xueyi.workflow.convert;

import com.xueyi.common.core.web.entity.model.BaseConverter;
import com.xueyi.workflow.domain.query.ProcessMetaQuery;
import com.xueyi.workflow.domain.dto.ProcessMetaDto;
import com.xueyi.workflow.domain.entity.ProcessMeta;
import com.github.pagehelper.Page;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

@Component
public class ProcessMetaConverter implements BaseConverter<ProcessMetaQuery, ProcessMetaDto, ProcessMeta> {
    @Override
    public ProcessMetaDto mapperDto(ProcessMeta po) {
        if (po == null) return null;
        ProcessMetaDto dto = new ProcessMetaDto();
        BeanUtils.copyProperties(po, dto);
        return dto;
    }
    @Override
    public List<ProcessMetaDto> mapperDto(Collection<ProcessMeta> poList) {
        if (poList == null) return null;
        return poList.stream().map(this::mapperDto).collect(Collectors.toList());
    }
    @Override
    public Page<ProcessMetaDto> mapperPageDto(Collection<ProcessMeta> poList) {
        // 如有分页需求可实现
        return null;
    }
    @Override
    public ProcessMeta mapperPo(ProcessMetaDto dto) {
        if (dto == null) return null;
        ProcessMeta po = new ProcessMeta();
        BeanUtils.copyProperties(dto, po);
        return po;
    }
    @Override
    public List<ProcessMeta> mapperPo(Collection<ProcessMetaDto> dtoList) {
        if (dtoList == null) return null;
        return dtoList.stream().map(this::mapperPo).collect(Collectors.toList());
    }
    @Override
    public Page<ProcessMeta> mapperPagePo(Collection<ProcessMetaDto> dtoList) {
        // 如有分页需求可实现
        return null;
    }
} 